
var objFSO = new ActiveXObject( "Scripting.FileSystemObject" );

var regExp = new RegExp( SearchParms.FilenameCustomParm, "i" );

function isValidFileName( strPath, strFileName )
{
	// Open the folder and see if there are any files which match the given regular expression
	
	try
	{
		var strFolderPath = strPath + strFileName
		
		if ( objFSO.FolderExists( strFolderPath ) )
		{
			var folderCheck = objFSO.GetFolder( strFolderPath );
			var fc = new Enumerator(folderCheck.files);

			for (; !fc.atEnd(); fc.moveNext())
			{
				if ( regExp.test( fc.item() ) )
					return true;
			}
		}
	}
	catch( e )	{}
	return false;
}